package io.github.uicdb.gravity_generator;

import com.mojang.logging.LogUtils;
import net.minecraft.client.renderer.ItemBlockRenderTypes;
import net.minecraft.client.renderer.RenderType;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.slf4j.Logger;

// The value here should match an entry in the META-INF/mods.toml file
@Mod(GGUtils.MODID)
public class GGMod {

    // Directly reference a slf4j logger
    private static final Logger LOGGER = LogUtils.getLogger();
    public GGMod() {
        IEventBus bus=FMLJavaModLoadingContext.get().getModEventBus();
        GGRegistries.BLOCKS.register(bus);
        GGRegistries.ITEMS.register(bus);
        GGRegistries.BLOCK_ENTITY_TYPES.register(bus);
        bus.addListener(GGMod::clientSetup);
        GGConfig.registerConfig();
    }

    private static void clientSetup(FMLClientSetupEvent event) {
        event.enqueueWork(()->{
            ItemBlockRenderTypes.setRenderLayer(GGRegistries.GRAVITY_GENERATOR.get(), RenderType.cutoutMipped());
            ItemBlockRenderTypes.setRenderLayer(GGRegistries.HARMLESS_GRAVITY_GENERATOR.get(), RenderType.cutoutMipped());
        });
    }


}
